﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TvViewer.MpTvService;

namespace TvViewer
{
  public partial class RecordingProgramInputBox : Form
  {
    WebProgram m_program;
    private String m_recordingName;
    private int m_startEarlier;
    private int m_endLater;

    public int StartEarlier
    {
      get { return m_startEarlier; }
      set { m_startEarlier = value; }
    }

    public int EndLater
    {
      get { return m_endLater; }
      set { m_endLater = value; }
    }

    public String RecordingName
    {
      get { return m_recordingName; }
      set { m_recordingName = value; }
    }

    public RecordingProgramInputBox(WebProgram _program)
    {
      InitializeComponent();
      m_program = _program;

      txtProgramTitle.Text = _program.Title;
      txtProgramDescription.Text = _program.description;

      txtRecordingName.Text = DateTime.Now.ToString() + " - " +
                              _program.Title;

      txtProgramBegin.Text = _program.startTime.ToString();
      txtProgramEnd.Text = _program.endTime.ToString();
    }

    private void cmdOk_Click(object sender, EventArgs e)
    {
      try
      {
        m_startEarlier = txtStartEarlier.Text.Equals("") ? 0 : Int32.Parse(txtStartEarlier.Text);
        m_endLater = txtStartLater.Text.Equals("") ? 0 : Int32.Parse(txtStartLater.Text);
        m_recordingName = txtRecordingName.Text;
        this.DialogResult = DialogResult.OK;
      }
      catch (Exception ex)
      {
        MessageBox.Show("Please enter valid values");
      }


    }

    private void cmdCancel_Click(object sender, EventArgs e)
    {
      this.DialogResult = DialogResult.OK;
    }


  }
}
